﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace QuotationService.RealtimeQuotation
{
    /// <summary>
    /// ETF基本资料
    /// </summary>
    internal class ETFBasicInfo
    {
        /// <summary>
        /// ETF基金代码
        /// </summary>
        public string Code { get; set; }

        /// <summary>
        /// ETF基金名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 证券代号
        /// </summary>
        public string StkId { get; set; }


        /// <summary>
        /// ETF类型
        /// </summary>
        public string ETFType { get; set; }

        /// <summary>
        /// 基金市场代码
        /// </summary>
        public char FundMarket { get; set; }

        /// <summary>
        /// 最小赎回单位
        /// </summary>
        public Int32 CreationRedemptionUnit { get; set; }

        /// <summary>
        /// T日预估现金余额
        /// </summary>
        public double EstimateSettlementCashAmt { get; set; }

        /// <summary>
        /// T－1日申购赎回现金差额
        /// </summary>
        public double SettlementCashAmt { get; set; }

        /// <summary>
        /// 现金替代比例上限
        /// </summary>
        public double MaxCashRatio { get; set; }

        /// <summary>
        /// 交易日
        /// </summary>
        public Int32 TradeDate { get; set; }

        /// <summary>
        /// 前一个交易日
        /// </summary>
        public Int32 PreTradeDate { get; set; }

        /// <summary>
        /// T－1 日申购赎回基准单位净值
        /// </summary>
        public double NAVperCU { get; set; }

        /// <summary>
        /// T－1 日基金的单位净值
        /// </summary>
        public double NAV { get; set; }

        /// <summary>
        /// 总金额
        /// </summary>
        public double TotalAmt { get; set; }

        /// <summary>
        /// 本所成份股数
        /// </summary>
        public Int32 LocalExchStkCount { get; set; }

        /// <summary>
        /// 非本所成份股数
        /// </summary>
        public Int32 OtherExchStkCount { get; set; }

        /// <summary>
        /// 成份股总数量
        /// </summary>
        public Int32 ComponentStockQty { get; set; }

        /// <summary>
        /// 申购买卖控制标志
        /// </summary>
        public char CreationFlag { get; set; }

        /// <summary>
        /// 赎回买卖控制标志
        /// </summary>
        public char RedemptionFlag { get; set; }

        /// <summary>
        /// 跨境替代总金额
        /// </summary>
        public double ExternalTotalAmount { get; set; }

          /// <summary>
        /// 本市场的现金替代代码
        /// </summary>
        public string LocalExchCashId { get; set; }

        /// <summary>
        /// 非本市场的现金替代代码
        /// </summary>
        public string OtherExchCashId { get; set; }
        
        /// <summary>
        /// ETF成份股信息
        /// </summary>
        public ETFComponent[] Components { get; set; }

        /// <summary>
        /// 版本,格式为：YYYYMMDDxxxxxx，即：年月日+递增数字
        /// </summary>
        public Int64 Version { get; set; }

        /// <summary>
        /// 信息更新时间
        /// </summary>
        public DateTime UpdateTime { get; set; }
    }

    /// <summary>
    /// ETF成份股信息
    /// </summary>
    //[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)]
    public class ETFComponent
    {
        /// <summary>
        /// ETF商品代码
        /// </summary>
        public string Code { get; set; }

        /// <summary>
        /// 商品名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 数量
        /// </summary>
        public Int32 ExecuteQty { get; set; }

        /// <summary>
        /// 申购替代金额
        /// </summary>
        public double ApplyCashReplaceAmt { get; set; }

        /// <summary>
        /// 赎回替代金额
        /// </summary>
        public double RedemptionCashReplaceAmt { get; set; }

        /// <summary>
        /// 溢价比例
        /// </summary>
        public double PremiumRate { get; set; }

        /// <summary>
        /// 替代标志
        /// </summary>
        public char ReplaceFlag { get; set; }

        /// <summary>
        /// 允许交易标志
        /// </summary>
        public char TradeFlag { get; set; }

        /// <summary>
        /// 成份股市场
        /// </summary>
        public char ExchID { get; set; }
    }
}
